﻿using ScreenMonitor.Common.Objects;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ScreenMonitor.ServerLib
{
    /// <summary>
    /// 表示远程控制中心
    /// </summary>
    [Obsolete("尚未实现",true)]
    public static class ReomteControlCenter
    {
        #region========私有变量========

        /// <summary>
        /// 标记鼠标位置是否已经改变
        /// </summary>
        private static bool IsMousePosChanged=true;

        #endregion

        #region==========属性==========

        /// <summary>
        /// 表示远程控制主线程
        /// </summary>
        public static Task ControlTask { get; private set; }
        /// <summary>
        /// 表示正在远程控制的客户端
        /// </summary>
        public static ClientObject Client { get; private set; }
        /// <summary>
        /// 表示远程控制频率
        /// </summary>
        public static int ControlRate { get; set; }
        /// <summary>
        /// 表示当前鼠标坐标
        /// </summary>
        public static Point MousePoint { get; private set; }

        #endregion

        #region========公有函数=========

        /// <summary>
        /// 移动鼠标到指定位置
        /// </summary>
        /// <param name="P">要把鼠标移动到的位置</param>
        public static void MoveMouse(Point P)
        {
            if (P == MousePoint)
            {
                return;
            }
            else
            {
                MousePoint = P;
                IsMousePosChanged = true;
            }

        }

        /// <summary>
        /// 开始向指定客户端执行控制
        /// </summary>
        /// <param name="Client">要控制的客户端</param>
        public static void Start(ClientObject Client)
        {

        }

        #endregion

        #region========私有函数========

        private static void SetMousePoint()
        {
            if (IsMousePosChanged)
            {
                Client.DoMouseEvent(MouseEventType.MouseMove, MousePoint);
            }
            System.Threading.Thread.Sleep(ControlRate);
        }

        #endregion

    }
}
